/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;

import java.util.Date;

/**
 *
 * @author Vic
 */
@Entity
public class Users implements Serializable {
    private static long serialVersionUID = 1L;

    /**
     * @return the serialVersionUID
     */
    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    /**
     * @param aSerialVersionUID the serialVersionUID to set
     */
    public static void setSerialVersionUID(long aSerialVersionUID) {
        serialVersionUID = aSerialVersionUID;
    }
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO) 
    private Long id;
    
    private String email;
    // Added for convenience, in deed should use SM's code for country and birthDay
    private String country;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date birthDate;
    private Long createTime;

    
    public Users(){
        createTime = new Date().getTime();
    } //no-arg onstructor

    //************************************************************************************
    //THE DATAFIELDS AND GET/SET EXCLUSIVELY USED BY TRANSACTION TEAM
    //************************************************************************************
    
    private Integer loyaltypoint;
    
    @Temporal(javax.persistence.TemporalType.TIMESTAMP)
    private Date expirydate; 
    @Temporal(javax.persistence.TemporalType.TIMESTAMP)
    private Date mostRecentTransactionDate;
    @OneToOne
    private CustomerTier customerTier;
    @OneToMany  (cascade = {CascadeType.ALL}, mappedBy="customer" )
    private List<OutletReservation> reservations = new ArrayList<OutletReservation>();
    @ManyToMany 
    private List <GroupBuyingItem> groupBuy = new ArrayList<GroupBuyingItem>();

    @OneToMany ( cascade = {CascadeType.ALL} )
    private List<RewardVoucher> list_vouchers = new ArrayList<RewardVoucher>();
    
    @OneToMany ( cascade = {CascadeType.ALL} )
    private List<TransactionEntry> list_transactionEntry = new ArrayList<TransactionEntry>();
    
    @OneToMany (cascade={CascadeType.ALL})
    private List<PointsPurchaseRecord> pointsPurchaseLog = new ArrayList<PointsPurchaseRecord>();
    
    //-------------------------------------------------------------------------------------------------------------------

    public Integer getLoyaltypoint() {
        return loyaltypoint;
    }


    public void setLoyaltypoint(Integer loyaltypoint) {
        this.loyaltypoint = loyaltypoint;
    }


    public Date getExpirydate() {
        return expirydate;
    }


    public void setExpirydate(Date expirydate) {
        this.expirydate = expirydate;
    }


    public Date getMostRecentTransactionDate() {
        return mostRecentTransactionDate;
    }


    public void setMostRecentTransactionDate(Date mostRecentTransactionDate) {
        this.mostRecentTransactionDate = mostRecentTransactionDate;
    }


    public CustomerTier getCustomerTier() {
        return customerTier;
    }


    public void setCustomerTier(CustomerTier customerTier) {
        this.customerTier = customerTier;
    }


    public List<OutletReservation> getReservations() {
        return reservations;
    }


    public void setReservations(List<OutletReservation> reservations) {
        this.reservations = reservations;
    }
    
    public void addReservation(OutletReservation or){
        this.reservations.add(or);
    }
    

    //END transaction team datafields
    //************************************************************************************
    //************************************************************************************

    
    
    
    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

     /**
     * @return the email
     */
    public String getEmail() {
        return email;
    }

    /**
     * @param email the email to set
     */
    public void setEmail(String email) {
        this.email = email;
    }

    /**
     * @return the country
     */
    public String getCountry() {
        return country;
    }

    /**
     * @param country the country to set
     */
    public void setCountry(String country) {
        this.country = country;
    }

    /**
     * @return the birthDate
     */
    public Date getBirthDate() {
        return birthDate;
    }

    /**
     * @param birthDate the birthDate to set
     */
    public void setBirthDate(Date birthDate) {
        this.birthDate = birthDate;
    }

    /**
     * @return the groupBuy
     */
    public List <GroupBuyingItem> getGroupBuy() {
        return groupBuy;
    }

    /**
     * @param groupBuy the groupBuy to set
     */
    public void setGroupBuy(List <GroupBuyingItem> groupBuy) {
        this.groupBuy = groupBuy;
    }

    /**
     * @return the list_vouchers
     */
    public List<RewardVoucher> getList_vouchers() {
        return list_vouchers;
    }

    /**
     * @param list_vouchers the list_vouchers to set
     */
    public void setList_vouchers(List<RewardVoucher> list_vouchers) {
        this.list_vouchers = list_vouchers;
    }

    /**
     * @return the list_transactionEntry
     */
    public List<TransactionEntry> getList_transactionEntry() {
        return list_transactionEntry;
    }

    /**
     * @param list_transactionEntry the list_transactionEntry to set
     */
    public void setList_transactionEntry(List<TransactionEntry> list_transactionEntry) {
        this.list_transactionEntry = list_transactionEntry;
    }

    /**
     * @return the pointsPurchaseLog
     */
    public List<PointsPurchaseRecord> getPointsPurchaseLog() {
        return pointsPurchaseLog;
    }

    /**
     * @param pointsPurchaseLog the pointsPurchaseLog to set
     */
    public void setPointsPurchaseLog(List<PointsPurchaseRecord> pointsPurchaseLog) {
        this.pointsPurchaseLog = pointsPurchaseLog;
    }

    public Long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }
    
    
}
